<?php 
	$validationCode = REPLACE_Injection($_GET["code"]);
	$userId = REPLACE_Injection($_GET["u"]);
	$query = new mysqlQuery("tournament", "", "usuarios", "*", "`id`='".$userId."' AND `email_validation_code`='".$validationCode."'", "", "");
	$query->execute();
	if($query->getCount() == 1){
		$row = $query->next();
		$fields = array("email_validation_code");
		$values = array("");
		$update = new mysqlUpdate("tournament", "" , "usuarios", $fields, $values, "`id`='".$userId."'");
		$update->execute();
		createSession($userId, $row["usuario"], $row["level"], $row["email"]);
	}else{
		$error = "The link you have followed is not valid or has expired";
	}
?>

<div id="content">
	<h1>An error has ocurred</h1>
	<div id="error">
		In order to access PES6J Tournament you need to validate your PES6J Forum Account.
		<br/>
		If you don't have an account, register for free.
	</div>
	<a href="http://www.pes6j.net/forum" class="back">Go back to the Forum and Login</a>
	<a href="http://www.pes6j.net/forum" class="back">Register a New Account</a>
</div>